import request from '@/utils/request'

// 获取销售额
export const getOrderAmount = (data) =>
  request.get('/api/order-service/report/orderAmount', { params: data })

// 获取订单数
export const getOrderCount = (data) =>
  request.get('/api/order-service/report/orderCount', { params: data })

// 获取工单数据
export const getTaskReportInfo = (data) =>
  request.get(`/api/task-service/task/taskReportInfo/${data.start}/${data.end}`)

// 商品热榜
export const getSkuTop = (data) =>
  request.get(
    `/api/order-service/report/skuTop/10/${data.start.split(' ')[0]}/${data.end.split(' ')[0]}`
  )

// 获取故障的十个设备
export const getErrorStatus10 = () => request.get('/api/status-service/status/top10')

// 获取销售额统计
export const getAmountCollect = (num,data) => request.get(`/api/order-service/report/amountCollect/${num}/${data.start.split(' ')[0]}/${data.end.split(' ')[0]}`)

// 获取销售量分布
export const getRegionCollect = (data) => request.get(`/api/order-service/report/regionCollect/${data.start.split(' ')[0]}/${data.end.split(' ')[0]}`)


//、、、、、、、、、、、 点位管理

// 区域管理 //新增点位获取区域列表
export const regionalManagement = data => request.get('/api/vm-service/region/search', {
  params: {
    ...data
  }
})
// // 新增区域
export const addArea = data => request.post('/api/vm-service/region', data)
// 修改区域
export const reviseArea = data => request.put(`/api/vm-service/region/${data.id}`, 
  {
    regionName: data.regionName,
    remark: data.remark
  }
)
// 删除区域
export const delArea = id => request.delete(`/api/vm-service/region/${id}`)
// 区域详情
export const omn = data => request.get(`/api/vm-service/node/search`, {
  params: {
    ...data
  }
})
// 点位管理 // 点位搜索
export const point = data => request.get(`/api/vm-service/node/search`, {
  params: {
    ...data
  }
})
// 点位管理删除
export const delPoint = id => request.delete(`/api/vm-service/node/${id}`)

// 商圈列表
export const busines = () => request.get('/api/vm-service/businessType')
// 合作商搜索
export const partners = params => request.get('/api/user-service/partner/search', {
  params
})
// 新增点位
export const addPoint = data => request.post('/api/vm-service/node', data)
// 修改点位
export const resPoint = data => request.put(`/api/vm-service/node/${data.id}`,{
  ...data
})
// 点位查看详情
export const lop = (id) => request.get(`/api/vm-service/node/vmList/${id}`)
// 新增合作商/api/user-service/partner
export const cooperate = data => request.post('/api/user-service/partner', {
  ...data
})
// 修改合作商
export const changeCooperate = data => request.put(`/api/user-service/partner/${data.id}`, {
  ...data
})
// 删除合作商
export const delcooperate = id => request.delete(`/api/user-service/partner/${id}`)
// 重置密码
export const reset = id => request.put(`/api/user-service/partner/resetPwd/${id}`)